package com.taxsystem.gaozhuanglin.invoicebusiness;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.main.taxsystem.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.GridView;
import android.widget.SimpleAdapter;

public class InvoiceActivity extends Activity {
	
	GridView gridView;
	
	private static final String [] itemText = {"发票校验", "中奖登记", "中奖查询"};
	private static final int [] itemLogo = {R.drawable.fpjy, R.drawable.zjdj, R.drawable.zjcx};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_invoice);
		
		gridView = (GridView)findViewById(R.id.gv);
		
		List<Map<String, Object>> items = new ArrayList<Map<String, Object>>();
		for(int i = 0; i < 3; i++)
		{
			Map<String, Object> item = new HashMap<String, Object>();
			item.put("imageItem", itemLogo[i]);
			item.put("textItem", itemText[i]);
			items.add(item);
		}
		SimpleAdapter adapter = new SimpleAdapter(this, items, R.layout.grid_item, new String[]{"imageItem", "textItem"}, new int[]{R.id.image_item, R.id.text_item});
		gridView.setAdapter(adapter);
		
		gridView.setOnItemClickListener(new OnItemClickListener()
		{

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position,
					long id) {
				// TODO Auto-generated method stub
				Intent intent = null;
				switch((int)id)
				{
				    case 0:
				    	intent = new Intent(InvoiceActivity.this, VerifyActivity.class);
				    	startActivity(intent);
				    	break;
				    case 1:
				    	intent = new Intent(InvoiceActivity.this, RegisterActivity.class);
				    	startActivity(intent);
				    	break;
				    case 2:
				    	intent = new Intent(InvoiceActivity.this, InquireActivity.class);
				    	startActivity(intent);
				    	break;
				}
			}
			
		});
		
	}

	
}
